Skip to main content

Harici TypeScript Dosyası Kullanımı

Dependency Management Between TypeScript Files in Synergy IDE Environment

This documentation describes how to effectively manage dependencies and provide cross-file access between TypeScript files in the Synergy IDE environment.

File Structure

As an example, there is a folder named 'ClientHelpers' in our project and under this folder there is a TypeScript file named 'Calculator.ts'. This file contains a helper class that can perform tax calculations.

Calculator.ts

The file 'Calculator.ts' defines a class that can perform tax calculations. Within this class, a fixed value of '18%' is used as the tax rate.

'''TypeScript export class CalculatorHelper { private taxValue: number = 18;

getBringTaxAmount(value: number): number { return value * parseFloat('1.${this.taxValue}'); } }


### Access from Other Files

To use the 'CalculatorHelper' class from other TypeScript files, it is necessary to add the following import line to the top of the corresponding file:

'''TypeScript
@ts-ignore
import { CalculatorHelper } from "/ClientHelpers/CalculatorHelper";

Use Case

Below is an example of how to use the 'CalculatorHelper' class. This example calculates tax on the amount charged to a user and returns the result.

'''TypeScript var calculatorHelper = new CalculatorHelper(); var result = calculatorHelper.getBringTaxAmount(100); console.log(result); The calculated tax amount will appear in the printout.


### Advantages

Thanks to this structure, any changes to the 'CalculatorHelper' class will directly affect the entire project, so it will take less effort to implement the changes. In addition, this method increases the reusability and modularity of the code.

### Conclusion

In a Synergy IDE environment, dependency management between TypeScript files is critical to improving the modularity and maintainability of the code. This documentation provides a basic guide on how to manage this process.